package com.whale.widget;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.whale.R;

public class SeeMoreCommentView extends LinearLayout {
	private Context mContext = null;
	private View mChildView = null;
	private ProgressBar mPB = null;

	public SeeMoreCommentView(Context context) {
		super(context);
		mContext = context;

		this.setOrientation(LinearLayout.VERTICAL);
		this.setLayoutParams(new ListView.LayoutParams(
				ListView.LayoutParams.FILL_PARENT,
				ListView.LayoutParams.WRAP_CONTENT));
		this.setBackgroundResource(R.drawable.bg_comment_more_area);

		View view = LayoutInflater.from(mContext).inflate(
				R.layout.seemore_comment, null);
		mPB = (ProgressBar) view.findViewById(R.id.pb);
		this.addView(view);
		mChildView = view;
		getTextView().setText(R.string.more_comment);
	}

	public TextView getTextView() {
		return (TextView) mChildView.findViewById(R.id.tv_msg);
	}

	public void setProgressBarActive(boolean active) {
		if (active) {
			getTextView().setText(R.string.fetching);
			mPB.setVisibility(View.VISIBLE);
		} else {
			getTextView().setText(R.string.more);
			mPB.setVisibility(View.GONE);
		}
	}
}
